﻿using MediatR;
using T_Person.APi.Applation.CommandHandlers.PersonnelHandlers;
using T_Person.BaseRep.Interface;

namespace T_Person.APi.Applation.Commands.PersonnelCommand
{
    public class PersonnelDeleteHandlers : IRequestHandler<PersonnelsDeleteHandler, int>
    {
        private readonly IPersonnelRep personnelRep;

        public PersonnelDeleteHandlers(IPersonnelRep personnelRep)
        {
            this.personnelRep = personnelRep;
        }

        public async Task<int> Handle(PersonnelsDeleteHandler request, CancellationToken cancellationToken)
        {
            var list = await personnelRep.GetAloneByid(request.id);
            list.IsDel=true;
            return await personnelRep.Update(list);
        }
    }
}
